/*
 * @Author: 詹真琦(legendryztachi@gmail.com)
 * @Date: 2022-01-25 16:32:30
 * @LastEditors: 詹真琦(legendryztachi@gmail.com)
 * @LastEditTime: 2022-05-07 19:08:39
 * @FilePath: \code\cwp-front\pc-collaboration\src\store\modules\summary\tab.js
 * @Description: 正文和流程切换
 */
import { defineStore } from 'pinia';
import pinia from '@/store';
import globalData from "@/plugins/data";
export const useSummaryTabStore = defineStore('summaryTab', {
    state: () => ({
        isLoadWorkflow: false, //是否加载工作流。用于一进页面不加载工作流
        activeIndex: 0, //选的正文还是流程
        panelList: [globalData.isStandard ? $.i18n('common.toolbar.content.label') : $.i18n('common.form.label'),
            $.i18n('common.workflow.label')],
        flowIframe: null, //流程iframe
    }),
    actions: {
        changeActiveIndex(index = 1) {
            console.log(index);

            if (index) {
                this.isLoadWorkflow = true;
            }
            this.activeIndex = index;
        },
    },
});

//在vue上下文之外使用
export function useSummaryTabWithOut() {
    return useSummaryTabStore(pinia);
}
